package com.egitim.panels;
 
 
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.Panel;

import com.egitim.cati.Makale;
import com.egitim.model.AnaGonderi;
import com.egitim.model.BaseEntity;
import com.egitim.util.UtilityUrl;
 
 

/**
 * Shows a list of people.
 * 
 * @author R.J. Lorimer
 */
public class TekMakalePanel extends Panel {
 
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * Id constructor.
	 * @param id the Id.
	 */
 
	public TekMakalePanel(String id, BaseEntity baseEntity) {
		super(id);
		AnaGonderi anaGonderi = new AnaGonderi();
		anaGonderi=(AnaGonderi) baseEntity;
		PageParameters pageParameters=new PageParameters();
		pageParameters.add("makaleId", anaGonderi.getId().toString());
		
		BookmarkablePageLink<Makale> bookmarkablePageLink=new BookmarkablePageLink<Makale>("makaleAdiLink"
																					, Makale.class);
	    bookmarkablePageLink.add(new Label("makaleAdiLabel",anaGonderi.getTitle()));
	    add(bookmarkablePageLink);
	    
	    Label makaleIcerigiLabel=new Label("makaleIcerigiLabel", anaGonderi.getText());
        makaleIcerigiLabel.setEscapeModelStrings(false);
	    add(makaleIcerigiLabel);
	    
	    Label makaleTarihiLabel=new Label("makaleTarihiLabel", anaGonderi.getCreatedAt().toString());
	    add(makaleTarihiLabel);
	    StringBuffer stringBuffer=new StringBuffer();
	    stringBuffer.append("<div class=\"fb-like\" ");
	    stringBuffer.append(" data-href=\"");
	    stringBuffer.append(UtilityUrl.getRequestUrl(getRequest()));
	    stringBuffer.append("\" data-num-posts=\"2\" data-width=\"550\"></div>");  
	    
	    Label facebookLike=new Label("facebookLike", stringBuffer.toString());
	    facebookLike.setEscapeModelStrings(false);
        add(facebookLike);
        
        stringBuffer.replace(15,19,"comments");
        Label facebookComment=new Label("facebookComment", stringBuffer.toString());
	    facebookComment.setEscapeModelStrings(false);
        add(facebookComment);
	 }
	 
}

